package cn.handong.tool.Java文件操作;

import cn.handong.tool.Java文件操作.model.ExcelData;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;

import java.util.ArrayList;
import java.util.List;

public class 写入Excel {
    public static void main(String[] args) {
        //excel写入文件
        List<ExcelData> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            ExcelData data = new ExcelData();
            data.setCount(i);
            data.setGender(i+"");
            data.setId(i+"");
            data.setIp(i+"");
            data.setName(i+"");
        }
        EasyExcel.write("C:\\hd\\测试文件.xls")
                .head(ExcelData.class)
                .excelType(ExcelTypeEnum.XLS)
                .sheet("测试文件")
                .doWrite(list);
    }

}
